package com.wc.alorithm_blue_bridge._数学知识.质数.质数;

import java.util.Scanner;

/**
 * @Author congege
 * @Description 质数
 * http://43.138.190.70:8888/p/LQ1031T
 * https://www.lanqiao.cn/problems/608/learning/?page=1
 * @Date Created in 2023/11/24-17:44
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] nums = new long[1000000+1];
        int maxIdx = 0;
        while (n-- > 0) {
            int idx = sc.nextInt();
            while (idx > maxIdx) {
                long stNum = nums[maxIdx] + 1;
                while (!isPrime(stNum)) {
                    stNum++;
                }
                nums[maxIdx + 1] = stNum;
                maxIdx++;
            }
            System.out.println(nums[idx]);
        }
    }

    public static boolean isPrime(long num) {
        if (num <= 1) {
            return false;
        }
        long mid = (long) Math.sqrt(num);

        for (long i = 2; i <= mid; i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }
}
